<%@page import="java.sql.Date"%>
<%@page import="com.metagurukul.metaspace.service.UserService"%>
<%@page import="com.metagurukul.metaspace.models.beans.UserPersonalDetail"%>
<%
	if (session.getAttribute("user") == null)
		response.sendRedirect("../index.jsp");
%>
<%@ page errorPage="/jsp/exceptionHandler.jsp" %>
<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;">
   <script language="javaScript" type="text/javascript" src="../resources/js/calendar.js"></script>
   <link href="../resources/css/calendar.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
int userId = -1;
if (request.getSession().getAttribute("id") != null) {
	userId = (Integer) request.getSession().getAttribute("id");
}
UserPersonalDetail userpersonalDetail = UserService.getUserPersonalDetail(userId);

%>
      <% if(userpersonalDetail != null){ Date dob = userpersonalDetail.getDate(); %>
      <html:text property="date" value="<%= (dob.getDate()) + "-" + (dob.getMonth()+1) + "-" + (dob.getYear()+1900) %>" onkeydown="this.blur()"/>
      <% } else{ %>
      <html:text property="date" onkeydown="this.blur()"/>
      <%} %>
      <a href="#" onClick="setYears(1940, 2050); showCalender(this, 'date');">
      <html:img src="../resources/images/calender.png"/></a>
    <!-- Calender Script  --> 

    <table id="calenderTable">
        <tbody id="calenderTableHead">
          <tr>
            <td colspan="4" align="center">
	          <select onChange="showCalenderBody(createCalender(document.getElementById('selectYear').value,
	           this.selectedIndex, false));" id="selectMonth">
	              <option value="0">Jan</option>
	              <option value="1">Feb</option>
	              <option value="2">Mar</option>
	              <option value="3">Apr</option>
	              <option value="4">May</option>
	              <option value="5">Jun</option>
	              <option value="6">Jul</option>
	              <option value="7">Aug</option>
	              <option value="8">Sep</option>
	              <option value="9">Oct</option>
	              <option value="10">Nov</option>
	              <option value="11">Dec</option>
	          </select>
            </td>
            <td colspan="2" align="center">
			    <select onChange="showCalenderBody(createCalender(this.value, 
				document.getElementById('selectMonth').selectedIndex, false));" id="selectYear">
				</select>
			</td>
            <td align="center">
			    <a href="#" onClick="closeCalender();"><font color="white" size="+1">X</font></a>
			</td>
		  </tr>
       </tbody>
       <tbody id="calenderTableDays">
         <tr style="">
           <td>Sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Thu</td><td>Fri</td><td>Sat</td>
         </tr>
       </tbody>
       <tbody id="calender"></tbody>
    </table>

<!-- End Calender Script  --> 
	
</body>
</html>